package com.jchy.photo;

import java.sql.ResultSet;
import java.sql.SQLException;

public class Person
{
	public static String LastNameFirst(ResultSet rs) 
	throws SQLException
	{
		String value;
		
		String firstName=rs.getString("firstName");
		String middleName=rs.getString("middleName");
		String lastName=rs.getString("lastName");
		String suffix=rs.getString("suffix");
		
		if(lastName.equals(""))
			value = firstName + " " + middleName;    
		else
			value = lastName + ", " + firstName + " " + middleName;    
		if(!suffix.equals(""))
			value=value+", " + suffix;
		
		return value;
	}
	
	public static String FullName(ResultSet rs) 
	throws SQLException
	{
		String value;
		
		String firstName=rs.getString("firstName");
		String middleName=rs.getString("middleName");
		String lastName=rs.getString("lastName");
		String maidenName=rs.getString("maidenName");
		String suffix=rs.getString("suffix");
		
		if(lastName.equals("") && middleName.equals(""))
			value=firstName;
		else if(middleName.equals(""))
			value = firstName + " " + lastName;    
		else
			value = firstName + " " + middleName + " " + lastName; 
		if(!suffix.equals(""))
			value=value+", "+suffix;
		if(!maidenName.equals(""))
			value=value+" (nee "+maidenName+")";
		return value;
	}
	
	public static String FirstNameLastName(ResultSet rs) 
	throws SQLException
	{
		String value;
		
		String firstName=rs.getString("firstName");
		String lastName=rs.getString("lastName");
		String suffix=rs.getString("suffix");
		
		if(lastName.equals(""))
			value=firstName;
		else 
			value = firstName + " " + lastName;    
		
		if(!suffix.equals(""))
			value=value+", "+suffix;
		return value;
	}
	
}